//
// Created by user on 2022/1/14.
//

#include <iostream>
#include <vector>
using namespace std;

int removeElement(vector<int>& nums, int val) {
    int n = nums.size();
    int left = 0;
    int right = 0;
    while (right<n){
        if(nums[right]!=val){
            nums[left]=nums[right];
            left++;
        }
        right++;
    }
    return left;
}

int main(){
    vector<int> nums = {3,2,2,3};
    int res = removeElement(nums, 2);
    cout<< "result:"<< res<<endl;
    return 0;

}